package com.yxq.mdt.app.modules.socialcontact.adapter;


import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.glide.GlideHelper;
import com.yxq.mdt.app.modules.socialcontact.bean.CommunityCentreBean;

import java.util.List;

public class CommunityCentreAdapter extends BaseQuickAdapter<CommunityCentreBean.ListBean, BaseViewHolder> {
    public CommunityCentreAdapter(int layoutResId, @Nullable List<CommunityCentreBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CommunityCentreBean.ListBean item) {
        helper.setText(R.id.circle_name, item.getGroupname());
        if (item.getMenberList().size() == 0) {
            return;
        }
        helper.setText(R.id.circle_update_number, "今日更新" + item.getDynamicNum());
        if (item.getMenberList().size() >= 3) {
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(0).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_one));
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(1).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_two));
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(2).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_there));
        } else if (item.getMenberList().size() >= 2) {
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(0).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_one));
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(1).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_two));
        } else if (item.getMenberList().size() >= 0) {
            GlideHelper.setLoadRoundImage(mContext, item.getMenberList().get(0).getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_update_img_one));
        }


    }

}
